<template>
	<view>
		<view class="top flex_wrap row_middle">
			<u-skeleton rows="1" :title="false" :rowsWidth="['100%']" :rowsHeight="['26px']" :loading="loading">
				<view class="flex_wrap">
					<u-text :text="`提交人:${model.submitManName}`" color="#588BF3" size="32rpx" />
					<u-text :text="constansCheckState[model.checkState]" :color="model.checkState === 2 ? '#588BF3' : '#FF6F6F'" align="right" size="32rpx" />
				</view>
			</u-skeleton>
			<!-- <u-text :text="'提交人:'+model.submitManName" color="#588BF3" size="32rpx" />
			<u-text text="审核中" color="#FF6F6F" align="right" size="32rpx" v-if="model.checkState==0"/>
			<u-text text="审核通过" color="#588BF3" align="right" size="32rpx" v-if="model.checkState==1"/>
			<u-text text="审核失败" color="#FF6F6F" align="right" size="32rpx" v-if="model.checkState==2"/> -->
		</view>
		<u-gap height="14rpx" bgColor="#F5F5F5" />
		<view class="form">
			<u-form labelPosition="left" :model="model" :labelStyle="labelStyle" labelWidth="160rpx">
				<u-form-item label="会议编号" :customStyle="formItemCustomStyle" borderBottom >
					<u-text :text="model.meetNum" align="right" color="#666"/>
				</u-form-item>
				<u-form-item label="主题" :customStyle="formItemCustomStyle" borderBottom >
					<u-text :text="model.theme" align="right" color="#666"/>
				</u-form-item>

				<u-form-item label="开始时间" :customStyle="formItemCustomStyle" borderBottom  >
					<u-text align="right" :iconStyle="iconStyle" color="#666" size="28rpx" :text="`${$u.timeFormat(model.startTime, 'yyyy-mm-dd hh:MM')}`" />
				</u-form-item>

				<u-form-item label="结束时间" :customStyle="formItemCustomStyle" borderBottom >
					<u-text align="right" :iconStyle="iconStyle" color="#666" size="28rpx" :text="`${$u.timeFormat(model.endTime, 'yyyy-mm-dd hh:MM')}`" />
				</u-form-item>

				<u-form-item label="地点" :customStyle="formItemCustomStyle" borderBottom >
					<u-text v-if="model.address == ''" align="right" :iconStyle="iconStyle" color="#666" size="28rpx" :text="model.province+model.city+model.county+model.address" />
					<u-text align="right" v-if="model.address != ''" :iconStyle="iconStyle" color="#666" size="28rpx" :text="model.address" />
				</u-form-item>
				<u-form-item label="报名范围" :customStyle="formItemCustomStyle"><u-text :text="constansAppointType[model.appointType]" align="right" /></u-form-item>
				<view class="customClass" v-if="model.appointType === '2'">
					<view class="chooseList">
						<view style="margin-right: 14rpx;margin-bottom: 20rpx;" v-for="(chooseItem, index) in model.meetingAppointList" :key="index">
							<u-tag size="mini" bgColor="#588BF3" :name="index" :text="chooseItem.salesmanName" />
						</view>
					</view>
				</view>

				<view class="flex_wrap" v-if="model.checkState==0">
					<u-button text="不通过" :plain="true" shape="circle" :hairline="false" :customStyle="buttonCustomStyle" @click="noAdopt"/>
					<u-button text="通过" shape="circle" :hairline="false" :customStyle="buttonCustomStyle1" @click="adopt" />
				</view>
			</u-form>
		</view>
	</view>
</template>

<script>
	import { getMeetDetailByMeetId , getCheckMeet } from '@/api/salesmanMeeting.js';
export default {
	data() {
		return {
			constansCheckState: {
				'0': '审核中',
				'1': '审核通过',
				'2': '审核失败',
				'3': '已撤销'
			},
			constansAppointType: {
				'0': '所有人',
				'1': '我的下级',
				'2': '指定下级'
			},
			buttonCustomStyle: {
				color: '#333',
				marginTop: '80rpx',
				width: '320rpx',
				height: '74rpx',
			},
			buttonCustomStyle1: {
				color: '#FFF',
				backgroundColor: '#588BF3',
				marginTop: '80rpx',
				width: '320rpx',
				height: '74rpx'
			},
			indexSearchKeyword: '',
			indexedChoosed: {},
			searchHeight: uni.upx2px(64),
			labelStyle: {
				fontSize: '28rpx',
				color: '#333',
				fontWeight: 'bold'
			},
			formItemCustomStyle: {
				padding: '32rpx 0'
			},
			formItemCustomStyle2: {
				padding: '0'
			},
			customInputStyle: {
				backgroundColor: '#F3F3F3',
				height: '80rpx',
				borderRadius: '20rpx'
			},
			iconStyle: 'fontSize:28rpx',
			meetId:'',
			checkState:'',
			model: {
				theme: 'xxx', //主题
				number:'11111111',
				startTime: '',
				endTime: '',
				startSubmitTime: '', //开始时间
				endSubmitTime: '', //结束时间
				illegalPlace: 'xxxx', //地址
				detailPlace: 'xxxx',
				latitude: '', //经度
				longitude: '', //纬度
				scopeValue: 2,
				chooseList: [{ name: 'xxx' }],
				meetDetailList:{}
			},
		};
	},
	onShow() {
		this.getMeetDetail(this.meetId);
	},
	onReady() {
	},
	onLoad(options) {
		this.options = options;
		let meetId = options.meetId;
		this.meetId = meetId
		this.getMeetDetail(this.meetId);
	},
	methods: {
		getMeetDetail(meetId) {
			const that = this;
			getMeetDetailByMeetId(meetId).then(res => {
				that.model = res.data;
				that.meetId=res.data.id;
			});
		},
		noAdopt(){//审核不通过
			const that = this;
			this.checkState=2;
			uni.showModal({
				content: '确认不通过该会议',
				success({ confirm, cancel }) {
					if (confirm) {
						getCheckMeet(that.meetId,that.checkState).then(res => {
							uni.$u.toast('会议审核不通过');
							that.getMeetDetail(that.meetId);
						});
					}
				}
			});
		},
		adopt() {
			const that = this;
			this.checkState=1;
			uni.showModal({
				content: '确认通过该会议',
				success({ confirm, cancel }) {
					if (confirm) {
						getCheckMeet(that.meetId,that.checkState).then(res => {
							uni.$u.toast('会议审核通过');
							that.getMeetDetail(that.meetId);
						});
					}
				}
			});
		},
		radioChangeHandler(e) {},
		
	}
};
</script>

<style>
page {
	background-color: #fff !important;
}
</style>

<style lang="scss" scoped>
.top {
	width: 100%;
	height: 108upx;
	padding: 0 30upx;
}
.form {
	padding: 0 38upx;
}
::v-deep.placeHolder {
	color: #666 !important;
	font-size: 28upx !important;
}
.radioGroupBox {
	display: flex;
	align-items: center;
}
.customClass {
	::v-deep.u-form-item__body {
		flex-direction: column !important;
	}
	.chooseList {
		margin-top: 30upx;
		display: flex;
		flex-wrap: wrap;
		justify-content: flex-start;
		margin-right: 20rpx;
	}
}
.indexBox {
	width: 100vw;
	.searchBox {
		width: 100vw;
		padding: 20upx 80upx 20upx 20upx;
	}

	.listBox {
		position: relative;
	}
}
</style>
